package com.vote.admin.controller;

import com.vote.admin.service.AdminRecordService;
import com.vote.admin.service.AdminUserService;
import com.vote.admin.vo.param.SwitchParam;
import com.vote.admin.vo.result.RecordResult;
import com.vote.admin.vo.result.UserResult;
import com.vote.common.returns.RespEntity;
import com.vote.common.returns.RespTable;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/admin-record")
@Slf4j
@Api(value = "管理平台投票记录", tags = "管理平台投票记录")
public class AdminRecordController {

    @Resource
    private AdminRecordService adminRecordService;

    @GetMapping("/list")
    @ApiOperation(value = "投票记录列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "page", value = "当前页数", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "limit", value = "每页数量", required = true)
    })
    public RespTable<List<RecordResult>> userList(@RequestParam(value = "page", required = true) Integer page,
                                                  @RequestParam(value = "limit", required = true) Integer limit) {
        RespTable<List<RecordResult>> respTable = adminRecordService.voteRecordList(page, limit);
        return respTable;
    }

}
